//
//  HMSportCaptureView.m
//  HMBest22
//
//  Created by Apple on 17/1/16.
//  Copyright © 2017年 Apple. All rights reserved.
//

#import "HMSportCaptureView.h"
#import "CZAdditions.h"
@interface HMSportCaptureView ()

@property (nonatomic,weak)IBOutlet UIImageView *imageV;
@end
@implementation HMSportCaptureView

- (void)drawRect:(CGRect)rect
{
    // 1.设置两个快门界面的背景颜色
    [[UIColor cz_colorWithHex:0x25282e] setFill];
    // 获取路径
    UIBezierPath *path = [UIBezierPath bezierPathWithRect:rect];
    // 填充路径
    [path fill];
    
    // 2.画分割线
    // 获取路径
    UIBezierPath *bezierPath = [UIBezierPath bezierPath];
    if (_imageV.frame.origin.x > 0)  {// 左侧快门界面
        [bezierPath moveToPoint:CGPointMake(self.bounds.size.width, 0)];
        
        [bezierPath addLineToPoint:CGPointMake(self.bounds.size.width, self.bounds.size.height)];
    }else{// 右侧快门界面
        [bezierPath moveToPoint:CGPointMake(0, 0)];
        
        [bezierPath addLineToPoint:CGPointMake(0, self.bounds.size.height)];
    }
    // 设置颜色
    [[UIColor cz_colorWithHex:0x1a1a1a] setStroke];
    // 设置路径
    [bezierPath stroke];
    
    // 3.清除区域
    CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectInset(_imageV.frame, 1, 1));
}

@end
